<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/12/25
 * Time: 20:02
 */
if (!empty($_FILES)) {
    if ($_FILES['file']['error'] == 0){
        echo "Upload: " . $_FILES["file"]["name"] . "<br />";
        echo "Type: " . $_FILES["file"]["type"] . "<br />";
        echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
        echo "Stored in: " . $_FILES["file"]["tmp_name"];
        $fileName = $_FILES['file']['tmp_name'];
        $distPath = "upload";
        if (!file_exists($distPath)) {
            mkdir($distPath,0777);
        }
        $savePath = $distPath."/". $_FILES['file']['name'];
        $file = move_uploaded_file($fileName,$savePath);
    }
}